//
//  httpRequest.m
//  yuanlei
//
//  Created by oi on 15/7/21.
//  Copyright (c) 2015年 oi. All rights reserved.
//

#import "httpRequest.h"
#import "ParamsHelper.h"

@implementation httpRequest


+ (void)loginToHomePageBy:(NSString *)username :(NSString *)password :(void(^)(NSDictionary *dic))success
{
   
    NSMutableDictionary* params =  [ParamsHelper createParams];
   // [ParamsHelper addNSStringParams:params :@"?api" :@"app_login"];
    [ParamsHelper addNSStringParams:params :@"username" :username];
    [ParamsHelper addNSStringParams:params :@"password" :password];
    
    [PostHelper post:mGetLoginUrl :params :success];

}

+ (void)getHomeBannerImgComplement:(void(^)(NSDictionary *dic))success
{
    
    [PostHelper post:mGetHomeBannerUrl:nil :success];

}

+ (void)getHomeVideoComplement:(void(^)(NSDictionary *dic))success
{
    
    [PostHelper post:mGetHomeVideoUrl:nil :success];
    
}


+ (void)getMoreThanVideo:(NSString *)categoryID :(NSString *)page Complement:(void(^)(NSDictionary *dic))success
{
    
     NSMutableDictionary* params =  [ParamsHelper createParams];
    [ParamsHelper addNSStringParams:params :@"session_id" :SESSION_ID];
    [ParamsHelper addNSStringParams:params :@"category_id" :categoryID];
    [ParamsHelper addNSStringParams:params :@"page" :page];
    [PostHelper post:mGetHomeVideoMoreThanUrl :params :success];
    
}

+ (void)getPersonPopNum:(NSString *)page
             Complement:(void(^)(NSDictionary *dic))success
{
    NSMutableDictionary* params =  [ParamsHelper createParams];
    [ParamsHelper addNSStringParams:params :@"session_id" :SESSION_ID];
    [ParamsHelper addNSStringParams:params :@"page" :page];
    [PostHelper post:mGetPopNumUrl :params :success];

}


+ (void)dianZanISSuccess:(NSString *)dianZanID
              Complement:(void(^)(NSDictionary *dic))success
{
    NSMutableDictionary* params =  [ParamsHelper createParams];
    [ParamsHelper addNSStringParams:params :@"session_id" :SESSION_ID];
    [ParamsHelper addNSStringParams:params :@"question_id" :dianZanID];
    
    [PostHelper post:mGetDianZanNumUrl :params :success];
    
}

+ (void)guanZhuISSuccess:(NSString *)guanzhuID
              Complement:(void(^)(NSDictionary *dic))success
{

    NSMutableDictionary* params =  [ParamsHelper createParams];
    [ParamsHelper addNSStringParams:params :@"session_id" :SESSION_ID];
    [ParamsHelper addNSStringParams:params :@"uid" :guanzhuID];
    
    [PostHelper post:mGetGuanzhuNumUrl :params :success];
}

+ (void)updateUserPhotoBy:(NSData *)userData
               Complement:(void(^)(NSDictionary *dic))success
{

    NSMutableDictionary* params =  [ParamsHelper createParams];
    [ParamsHelper addNSStringParams:params :@"session_id" :SESSION_ID];
    [PostHelper postImg:mGetUpdatePhotoUrl :params :userData :@"photo" :success];

}


+ (void)getPersonInfoComplement:(void(^)(NSDictionary *dic))success
{
    
    NSMutableDictionary* params =  [ParamsHelper createParams];
    [ParamsHelper addNSStringParams:params :@"session_id" :SESSION_ID];
    [PostHelper post:mGetPersonUrl :params :success];
    
}

+ (void)getVideoInfoBy:(NSString *)questionID Complement:(void(^)(NSDictionary *dic))success
{
    
    NSMutableDictionary* params =  [ParamsHelper createParams];
    [ParamsHelper addNSStringParams:params :@"session_id" :SESSION_ID];
    [ParamsHelper addNSStringParams:params :@"id" :questionID];
    [PostHelper post:mGetVideoUrl :params :success];
}

+ (void)getPostInfoBy:(NSString *)questionID :(NSString *)page Complement:(void(^)(NSDictionary *dic))success
{
    
    NSMutableDictionary* params =  [ParamsHelper createParams];
    [ParamsHelper addNSStringParams:params :@"session_id" :SESSION_ID];
    [ParamsHelper addNSStringParams:params :@"id" :questionID];
    [ParamsHelper addNSStringParams:params :@"page":page];
    [PostHelper post:mGetPostDescUrl  :params :success];
}


+ (void)sendMessageInfoBy:(NSString *)questionID
                         :(NSString *)answerContent
               Complement:(void(^)(NSDictionary *dic))success
{
    NSMutableDictionary* params =  [ParamsHelper createParams];
    [ParamsHelper addNSStringParams:params :@"session_id" :SESSION_ID];
    [ParamsHelper addNSStringParams:params :@"id" :questionID];
    [ParamsHelper addNSStringParams:params :@"answer_content":answerContent];
    [PostHelper post:msendMessageUrl  :params :success];

}

+ (void)sendSecondMessageInfoBy:(NSString *)answerID
                               :(NSString *)message
                     Complement:(void(^)(NSDictionary *dic))success

{

    NSMutableDictionary* params =  [ParamsHelper createParams];
    [ParamsHelper addNSStringParams:params :@"session_id" :SESSION_ID];
    [ParamsHelper addNSStringParams:params :@"answer_id" :answerID];
    [ParamsHelper addNSStringParams:params :@"message":message];
    [PostHelper post:msendSecondMessageUrl  :params :success];

}

+ (void)collectionTheVideoBy:(NSString *)questionID
                  Complement:(void(^)(NSDictionary *dic))success
{
    NSMutableDictionary* params =  [ParamsHelper createParams];
    [ParamsHelper addNSStringParams:params :@"session_id" :SESSION_ID];
    [ParamsHelper addNSStringParams:params :@"question_id" :questionID];

    [PostHelper post:mgetCollectionStateUrl :params :success];

}

@end

